<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>用户全局配置管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			 
			$("#name").focus();
			
			var val  = '${userDefine.recommendLottery}';
			if(val != "1"){
				val ="0";
			} 
			
			$("input[type='radio'][name='recommendLottery'][value='"+val+"']").attr("checked", "checked");
					
					
			$("#inputForm").validate({
				submitHandler: function(form){
					loading('正在提交，请稍等...');
					
					
					form.submit();
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
		});
		
		
		function changeReglotteryFlag(){
			var check = $('#regLottery');
			if(check.attr("checked") == "checked"){
				check.val("1");
				alert("change=checked=>"+check.val());
			}else{
				check.removeAttr("checked");
				check.val("0");
			}
			
			alert("change="+check.val());
			
		}
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<shiro:hasPermission name="sys:user:edit"><li><a href="${ctx}/wechat/userDefine/">用户全局配置列表</a></li></shiro:hasPermission>
		<li ><a href="${ctx}/wechat/userDefine/form?id=${userDefine.id}">用户全局配置<shiro:hasPermission name="wechat:userDefine:edit">${not empty userDefine.id?'修改':'添加'}</shiro:hasPermission><shiro:lacksPermission name="wechat:userDefine:edit">查看</shiro:lacksPermission></a></li>
		<li ><a href="${ctx}/wechat/userDefine/signUpForm?id=${userDefine.id}">用户签到设置<shiro:hasPermission name="wechat:userDefine:edit">${not empty userDefine.id?'修改':'添加'}</shiro:hasPermission><shiro:lacksPermission name="wechat:userDefine:edit">查看</shiro:lacksPermission></a></li>
		<li ><a href="${ctx}/wechat/userDefine/guestBookForm?id=${userDefine.id}">用户留言板设置<shiro:hasPermission name="wechat:userDefine:edit">${not empty userDefine.id?'修改':'添加'}</shiro:hasPermission><shiro:lacksPermission name="wechat:userDefine:edit">查看</shiro:lacksPermission></a></li>
		<li ><a href="${ctx}/wechat/userDefine/registerForm?id=${userDefine.id}">会员申请设置<shiro:hasPermission name="wechat:userDefine:edit">${not empty userDefine.id?'修改':'添加'}</shiro:hasPermission><shiro:lacksPermission name="wechat:userDefine:edit">查看</shiro:lacksPermission></a></li>
		<li class="active"><a href="${ctx}/wechat/userDefine/recommendForm?id=${userDefine.id}">推荐人设置<shiro:hasPermission name="wechat:userDefine:edit">${not empty userDefine.id?'修改':'添加'}</shiro:hasPermission><shiro:lacksPermission name="wechat:userDefine:edit">查看</shiro:lacksPermission></a></li>
		<%-- <li ><a href="${ctx}/wechat/userDefine/diancanForm?id=${userDefine.id}">点餐设置<shiro:hasPermission name="wechat:userDefine:edit">${not empty userDefine.id?'修改':'添加'}</shiro:hasPermission><shiro:lacksPermission name="wechat:userDefine:edit">查看</shiro:lacksPermission></a></li> --%>
	</ul><br/>
	<form:form id="inputForm" modelAttribute="userDefine" action="${ctx}/wechat/userDefine/saveUserDefineRecommend" method="post" class="form-horizontal"  enctype="multipart/form-data">
		<form:hidden path="id"/>
		<form:hidden path="user.id"/>
		
		
		<div class="control-group">
			<label class="control-label">推荐奖励分值设置:</label>
			<div class="controls">
				<input name="pRecommendScore" class="required number" type="text" htmlEscape="false" value="<fmt:formatNumber value='${userDefine.recommendScore/1000}' pattern='###.###'  minFractionDigits='3'/>">
				<label style="color:grey"><span class="alert">（元）精确到小数点后三位</span></label>
				<%-- <form:input path="recommendScore" htmlEscape="false" maxlength="11" class="number"/> 
				<label style="color:grey"><span class="alert">积分以“<span style="color:red;">厘</span>”为单位</span></label> --%>
			</div>
		</div>
		
		<div class="control-group">
			<label class="control-label">推荐奖金:</label>
			<div class="controls">
				<input name="pRecommendMoney"  htmlEscape="false" class="required number" type="text" value="<fmt:formatNumber value='${userDefine.recommendMoney/100}' pattern='###.##'  minFractionDigits='2'/>">
				<label style="color:grey"><span class="alert">（元）精确到小数点后两位</span></label>
				<%-- <form:input path="recommendMoney" htmlEscape="false" maxlength="11" class="number"/>  
				<label style="color:grey"><span class="alert">金额以“<span style="color:red;">分</span>”为单位</span></label> --%>
			</div>
		</div>
		
		
		<div class="control-group">
			<label class="control-label">至少推荐会员个数:</label>
			<div class="controls">
				<form:input path="requireSubMemberCount" htmlEscape="false" maxlength="11" class="number"/>  <span class="alert">满足本条件时才可以得得到奖品,积分不做此条件限制</span>
			</div>
		</div>
		
		
		<div class="control-group">
			<label class="control-label">是否送推荐奖品:</label>
			<div class="controls">
				<input type="radio" name="recommendLottery"  value="1"/>是 &nbsp;<input type="radio" name="recommendLottery"  value="0"/>否
			</div>
		</div>
		
		<div class="control-group">
			<label class="control-label">允许推荐奖品获取次数:</label>
			<div class="controls">
				<form:input path="recommendLotteryRepeatCount" htmlEscape="false" maxlength="100" cssClass="digits " /> <span class="alert">推荐人所赠送的礼品有效天数</span>
			</div>
		</div>
		
		<div class="control-group">
			<label class="control-label">推荐赠送礼品名称:</label>
			<div class="controls">
				<form:input path="recommendLotteryName" htmlEscape="false" maxlength="100" /> <span class="alert">推荐的会员申请成功赠送给推荐人的礼品名称</span>
			</div>
		</div>
		
		
		<div class="control-group">
			<label class="control-label">推荐奖品图文标题:</label>
			<div class="controls">
				<form:input path="recommendLotteryTitle" htmlEscape="false" maxlength="100" class=""/> <span class="alert">推荐奖品的图文标题</span>
			</div>
		</div>
		
		<div class="control-group">
			<label class="control-label">推荐奖品显示图片:</label>
				<div class="controls">
				<c:if test="${userDefine.recommendLotteryPic ne '' }">
					<div class="control"><img src="${ctxUser }/images/${userDefine.recommendLotteryPic}?t= + new Date().getTime()" style="width:300px;height:100px"/></div>
				</c:if>
				<div class="control">
					<input type="file" name="recommendPicFile"  />    <span class="alert">大图片建议尺寸：720像素 * 400像素;  小图片建议尺寸：400像素 * 400像素 </span>      
				</div>
			</div>
		</div>
		
		
		
		<div class="control-group">
			<label class="control-label">推荐奖品有效天数:</label>
			<div class="controls">
				<form:input path="recommendLotteryValidDays" htmlEscape="false" maxlength="100" cssClass="digits " /> <span class="alert">推荐人所赠送的礼品有效天数</span>
			</div>
		</div>
		
		
		
		
		<div class="control-group">
			<label class="control-label">推荐奖品图片描述:</label>
			<div class="controls">
				<form:textarea path="recommendLotteryDesc" htmlEscape="false" rows="3" cols="5"/> <span class="alert">推荐奖品回复时的图文描述</span>
			</div>
		</div>
		
		
		<div class="form-actions">
			<shiro:hasPermission name="wechat:userDefine:edit"><input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;</shiro:hasPermission>
			<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
		</div>
	</form:form>
</body>
</html>
